package com.hikvision.tcm.util;

import lombok.Data;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author :jianghui
 * @date : 2022/11/04 0:28
 */
@Data
public class SpringBeanUtils {

    public static ConfigurableApplicationContext applicationContext;

    public static void setApplicationContext(ConfigurableApplicationContext applicationContext) {
        SpringBeanUtils.applicationContext = applicationContext;
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static String getApplicationValue(String key) {
        return SpringBeanUtils.getApplicationContext().getEnvironment().getProperty(key) ;
    }
}
